The present invention generally relates to a method and apparatus for filling in an inner region of a pattern, and in particular to a method and apparatus for filling a region inside a closed loop line of a pattern with pixel data having values identical to those of pixel data forming the closed loop line. The present invention can be suitably applied to a picture image processing apparatus in which a picture image optically read by an image scanner is stored in an image memory, and is printed out by an image printer, for example.
At present, various picture image processing apparatuses have been utilized. For example, an optical reader has an image scanner which optically scans a sheet of paper and produces electric picture image data. The image data from the scanner are successively transferred to an image memory and are stored therein. The image data stored in the image memory are binary data (pixel data). For example, a picture pattern portion on the sheet is represented by a binary number one, and a background portion of the sheet is represented by a binary number zero. In the case where the image memory forms a bit map memory consisting of M rows and N columns, a pattern consisting of data of binary ones is formed on the map, so that it has a shape similar to the pattern on the sheet. The image data are successively read out from the image memory, and the pattern defined by the image data may be printed out by an image printer, for example.
In the above case, when printing out a pattern consisting of a closed loop line forming its contour line, there is occasionally needed a specific picture image processing in order that a pattern is printed out in a state where a region inside the closed contour of the pattern is totally "filled in (painted out)", or filled with printing dots. This is needed particularly when a handwritten graphic pattern is printed out.
A conventional method for filling-in the region inside the pattern consisting of the closed contour is firstly to scan the image memory in a main scanning direction coinciding with a direction of rows. During the main scan, an intersection point between a main scanning line and the contour line of the pattern consisting of the binary ones is monitored. When a first intersection point is detected, an operation of forcedly printing out a pixel of black, blue or the like is activated. That is, even when a pixel datum following the intersection point is a binary zero indicating a white or background pixel, the black pixel is forcedly printed out. This print-out operation is continued until a next intersection point is detected. Thereafter, when a third intersection point following the second intersect point is detected, the black pixel printing-out operation is activated again, and is continued, until a fourth intersection point is detected.
However, the above conventional method has the following disadvantages, which are now described with reference to FIGS. 1A and 1B. MAX1 to MAX3 denote maximum points on a closed contour line of a graphic pattern, and MIN1 to MIN3 denote minimum points thereon. When a binary image pattern corresponding to the illustrated pattern stored in the image memory is scanned, the point MAX1 is detected as the first intersection point. Thus, black pixels are forcedly printed out even when subsequent pixel data have binary zeros, and a line L1 is thereby formed outside the pattern. It is noted that in the illustrated example, the above printing-out operation is terminated at an end of the line, for simplicity. Similarly, several lines such as lines L2 and L3 are formed outside the pattern. Further, line areas of the inner region of the closed contour such as areas a.sub.1 and a.sub.2 are not provided with black pixels. Thus, blank portions are formed in the inner region. As is seen from the above description, the presence of the maximum and/or minimum points causes the incorrect picture printing operation.
A similar disadvantage arises from noise such as spots on the background of the sheet of paper. This is because the noise on the background is processed as a pixel and cannot be discriminated from the pixels configuring the picture.
Moreover, in a case where a pattern consisting of a thin closed loop line is optically read, there is a probability that the pattern configured by the corresponding binary image data has a partial discontinuity. It will be easily seen that this discontinuity causes an incorrect printing-out operation as above.